<template>
	<view class="pagesDoctorDetection">
		<searchBox :currentCode='currentCode' @handleSearch='handleSearch'></searchBox>
		<!-- <scroll-view scroll-y="true" @scrolltolower="scrolltolower" class="pagesdoctorPlusAdd_content"> -->
		<view class="content" v-if="ordersList.length>0">
			<extroOrderItem title='检测项详情' v-for="(item, index) in ordersList" :key="index" :orderObj='item' :itemIndex='index'
				:btnGroupArr="btnGroupArr" @handleClick="consultationTableButtonClick"></extroOrderItem>
			<view class="loadmoreView">
				<u-loadmore :status="status" />
			</view>

		</view>
		<pagesNoData v-else></pagesNoData>

		<!-- </scroll-view> -->

	</view>
</template>

<script>
	// 项目检测订单
	import extroOrderItem from '@/components/common/extroOrderItem.vue'
	import {
		mapState
	} from 'vuex'
	import {
		findAllExtraProjectOrders
	} from '@/api/platform/doctorPlusAdd.js'


	export default {
		name: "doctorDetection",
		components: {
			extroOrderItem
		},
		computed: {
			...mapState({
				userInfo: state => state.user.userInfo,
			}),
		},
		props: ['currentCode'],
		data() {
			return {
				ordersList: [],
				btnGroupArr: [

				],
				status: 'loadmore',
				total: 0,
				filterForm: {
					billingDoctorId: '',
					billingStartTime: '',
					billingEndTime: '',
					id: '',
					serialNumber: '',
					name: '',
					sendingHospitalId: '', //申请机构
					serviceCenterId: '', //会诊机构
					extraProjectStatus: '', //订单支付状态
					resultEntryStatus: '', //结果录入状态
					ningboOrderType: 2, //检测项目订单
					page: 0,
					size: 10,
				},
			};
		},
		mounted() {
			this.diagnosisTableRequest()
		},
		methods: {
			handleSearch(data) {
				console.log('doctorPlusAdd---', data)
				this.ordersList = []
				this.filterForm = data
				this.filterForm.ningboOrderType=2
				this.diagnosisTableRequest()

			},
			scrolltolower() {
				let that = this;
				this.status = 'loading';
				this.filterForm.page = ++this.filterForm.page;
				setTimeout(() => {
					if (this.ordersList.length < this.total) {
						this.status = 'loadmore'
						that.diagnosisTableRequest()
					} else {
						this.status = 'nomore'
					}

				}, 600)
			},
			diagnosisTableRequest() { //项目检测
				findAllExtraProjectOrders(this.filterForm).then(res => {
					if (res.code == 200) {
						this.total = res.rows.totalElements
						let ordersList = res.rows.content
						this.ordersList.push(...ordersList)
						if (this.ordersList.length < this.total) {
							this.status = 'loadmore'
						} else {
							this.status = 'nomore'
						}
					}
				})

			},




		}
	}
</script>

<style lang="scss" scoped>
	.pagesDoctorDetection {
		height: 100%;

		&_content {
			height: 100%;
		}
	}
</style>